package edu.codink.common.base;

import org.springframework.web.servlet.ModelAndView;

public class SpringModelView{
	/**
	 * VIEW
	 */
	private ModelAndView view;
	/**
	 * 构造函数
	 */
	public SpringModelView() {
		view=new ModelAndView();
	}
	/**
	 * 设置VIEW的名称
	 * @param viewName
	 * @return
	 */
	public SpringModelView setViewName(String viewName){
		view.setViewName("/web/"+viewName);
		return this;
	}
	/**
	 * 添加VIEW关联的属性
	 * @param attributeValue
	 * @return
	 */
	public SpringModelView addObject(Object attributeValue){
		view.addObject(attributeValue);
		return this;
	}
	/**
	 * 添加VIEW关联的属性
	 * @param attributeName
	 * @param attributeValue
	 * @return
	 */
	public SpringModelView addObject(String attributeName,Object attributeValue){
		view.addObject(attributeName, attributeValue);
		return this;
	}
	/**
	 * 清空VIEW
	 * @return
	 */
	public SpringModelView clear(){
		view.clear();
		return this;
	}
	/**
	 * 返回VIEW
	 * @return
	 */
	public ModelAndView getView(){
		return view;
	}
	
}
